
local CGTextureLists = CGTextureLists or {}
CGTextureLists.__index = CGTextureLists

function CGTextureLists.new()
    local self = setmetatable({}, CGTextureLists)
    self.inputs = {}
    self.nexts = {}
    self.TextureLists = {}
    return self
end

function CGTextureLists:setInput(index, func)
    self.inputs[index] = func
end

function CGTextureLists:setNext(index, func)
    self.nexts[index] = func
end

function CGTextureLists:getOutput(index)
    return self.TextureLists
end

function CGTextureLists:execute(index)
    self.TextureLists[0] = self.inputs[1]() or nil
    self.TextureLists[1] = self.inputs[2]() or nil
    self.TextureLists[2] = self.inputs[3]() or nil
    self.TextureLists[3] = self.inputs[4]() or nil
    if self.nexts[0] ~= nil then
        self.nexts[0]()
    end
end

function CGTextureLists:update(sys, deltaTime)
    self.TextureLists[0] = self.inputs[1]() or nil
    self.TextureLists[1] = self.inputs[2]() or nil
    self.TextureLists[2] = self.inputs[3]() or nil
    self.TextureLists[3] = self.inputs[4]() or nil
    if self.nexts[0] ~= nil then
        self.nexts[0]()
    end
end

return CGTextureLists